--add_rules("mode.debug", "mode.release")
add_rules("mode.debug")
--add_rules("plugin.vsxmake.autoupdate")
set_runtimes("MTd")
--add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode"})

set_languages("c++14")
add_requires("glew","gtest")
target("rtcsdk")
    add_rules("binary")
    add_cxflags("-g")
    add_cxxflags("-g")
    add_packages("glew","gtest")
    add_includedirs("../3rd/webrtc/include")
    add_includedirs("../3rd/webrtc/include/third_party/jsoncpp/generated")
    add_includedirs("../3rd/webrtc/include/third_party/jsoncpp/source/include")
    add_includedirs("../3rd/webrtc/include/third_party/abseil-cpp")
    add_includedirs("../3rd/webrtc/include/third_party/libyuv/include")
    add_includedirs("include")
    add_includedirs("src")
    add_linkdirs("../3rd/webrtc/lib/windows_debug_x64/")
    add_linkdirs("../3rd/glew/lib/Release/x64")
    add_defines("NOMINMAX","WEBRTC_WIN","WIN32_LEAN_AND_MEAN","_ENABLE_EXTENDED_ALIGNED_STORAGE")
    add_defines("WIN32","WIN64","USE_AURA=1","NO_TCMALLOC","FULL_SAFE_BROWSING","SAFE_BROWSING_CSD")
    add_defines("SAFE_BROWSING_DB_LOCAL","CHROMIUM_BUILD","_HAS_EXCEPTIONS=0","__STD_C")
    add_defines("_CRT_RAND_S","_CRT_SECURE_NO_DEPRECATE","_SCL_SECURE_NO_DEPRECATE")
    add_defines("_WINDOWS","CERT_CHAIN_PARA_HAS_EXTRA_FIELDS","PSAPI_VERSION = 2","_SECURE_ATL")
    add_defines("WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP","NTDDI_VERSION=NTDDI_WIN10_RS2")
    add_defines("DYNAMIC_ANNOTATIONS_ENABLED = 1","WTF_USE_DYNAMIC_ANNOTATIONS = 1")
    add_defines("WEBRTC_ENABLE_PROTOBUF=1","WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE")
    add_defines("RTC_ENABLE_VP9","HAVE_SCTP","WEBRTC_USE_H264","WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0")
    add_defines("ABSL_ALLOCATOR_NOTHROW=1","HAVE_WEBRTC_VIDEO","HAVE_WEBRTC_VOICE")
    add_defines("RTCCORE_LIB","ASIO_STANDALONE","_WEBSOCKETPP_CPP11_RANDOM_DEVICE_")
    add_defines("_WEBSOCKETPP_CPP11_INTERNAL_","_ATL_NO_OPENGL")
    add_defines("_DEBUG","UNICODE","_UNICODE","QT_NO_KEYWORDS")
    add_links("webrtc","ws2_32","secur32","winmm","version","wininet","advapi32","comdlg32","dbghelp")
    add_links("dnsapi","gdi32","msimg32","odbc32","odbccp32","oleaut32","shell32","shlwapi","user32","usp10","uuid")
    add_links("delayimp","ole32","crypt32","iphlpapi","dmoguids","wmcodecdspuuid","amstrmid","msdmo")
    add_links("strmiids","opengl32","winspool","kernel32")
    add_files("src/engine/RTC/*.cpp")
    set_installdir("install")

--
-- If you want to known more usage about xmake, please see https://xmake.io
--
-- ## FAQ
--
-- You can enter the project directory firstly before building project.
--
--   $ cd projectdir
--
-- 1. How to build project?
--
--   $ xmake
--
-- 2. How to configure project?
--
--   $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]
--
-- 3. Where is the build output directory?
--
--   The default output directory is `./build` and you can configure the output directory.
--
--   $ xmake f -o outputdir
--   $ xmake
--
-- 4. How to run and debug target after building project?
--
--   $ xmake run [targetname]
--   $ xmake run -d [targetname]
--
-- 5. How to install target to the system directory or other output directory?
--
--   $ xmake install
--   $ xmake install -o installdir
--
-- 6. Add some frequently-used compilation flags in xmake.lua
--
-- @code
--    -- add debug and release modes
--    add_rules("mode.debug", "mode.release")
--
--    -- add macro definition
--    add_defines("NDEBUG", "_GNU_SOURCE=1")
--
--    -- set warning all as error
--    set_warnings("all", "error")
--
--    -- set language: c99, c++11
--    set_languages("c99", "c++11")
--
--    -- set optimization: none, faster, fastest, smallest
--    set_optimize("fastest")
--
--    -- add include search directories
--    add_includedirs("/usr/include", "/usr/local/include")
--
--    -- add link libraries and search directories
--    add_links("tbox")
--    add_linkdirs("/usr/local/lib", "/usr/lib")
--
--    -- add system link libraries
--    add_syslinks("z", "pthread")
--
--    -- add compilation and link flags
--    add_cxflags("-stdnolib", "-fno-strict-aliasing")
--    add_ldflags("-L/usr/local/lib", "-lpthread", {force = true})
--
-- @endcode
--
